﻿@model mtm.Core.Models.IndexFilesModels
@{ 
    /* Copyright © 2009 - 2010 Oleg Stuhin & Rostislav Haitovich 
       To learn more about mytrip.mvc visit  
       http://mytripmvc.net  http://mytripmvc.codeplex.com 
       mytripmvc@gmail.com
       license: Microsoft Public License (Ms-PL) */ 
}
@{
    ViewBag.Title = Html.MytripPageTitle(CoreLanguage.file_manager);
    ViewBag.Keywords = mtm.Core.Settings.CoreSetting.HomePageKeyWords();
    ViewBag.Description = mtm.Core.Settings.CoreSetting.HomePageDesc();
}
@section scriptlink{
@Html.ScriptLink("jquery.validate.min.js,jquery.validate.unobtrusive.min.js,Page/File.js")
}
@section content{
@Html.BreadCumps(">", Model.bread)
<h1 class="title">@CoreLanguage.file_manager</h1>
<div class="content">
@using (Html.BeginForm()){
<div><div class="textboxR">
@Html.ValidationMessageFor(m => m.Name) 
</div></div><br />
@Html.MytripButton(CoreLanguage.create,true,"right")
<div class="textboxR">@Html.TextBoxFor(m=>m.Name)</div>
<div class="textboxR">@CoreLanguage.create_new_folder</div>
}
@using (Html.BeginForm("AddFile", "File", new { id = Model.Directory}, FormMethod.Post,new {enctype = "multipart/form-data" })){
<div style="clear: both;">
<div class="textboxR">@Html.ValidationMessageFor(m => m.Error)</div>
</div><br /><div class="textboxR" style="z-index:1000;">
@Html.MytripButton(CoreLanguage.upload, true, "right")</div>
<div class="textboxR">@Html.MytripInputFile("file", "id2")</div>
<div id="divfiletext" class="textboxR">@Html.TextBox("a", "", new { id = "filetext" })</div>
<div class="textboxR">@CoreLanguage.upload_file</div> 
}
<div style="height: 2px;clear: both;"></div></div>
<div class="last"></div>
<div class="content">
@Html.MytripImageLink(Url.Action("Index", new { id = string.Empty }), "/mtm/FileIcon/folder", Membership.ApplicationName, 0, 32, 0)
@Html.ActionLink(Membership.ApplicationName, "Index", new { id = "()" })
@Html.MytripDirectory(Model.Directory)
</div><div class="last"></div><div class="content">
<table>
<tr>
<th class="editdelite"></th>
<th class="folderfile"></th>
<th></th>
<th class="filechangedate">@CoreLanguage.change_date</th>
<th class="filesize">@CoreLanguage.size</th>
</tr>
@foreach (System.IO.DirectoryInfo x in Model.Folders)
{
    string directory = (Model.Directory == "()") ? "()" + x.Name : Model.Directory + "()" + x.Name;           
<tr><td>
@Html.MytripImgInput("/images/rename.png", "/File/Rename/" + directory + "/folder", "rename")
@Html.MytripImgInput("/images/delete.png", "/File/Delete/" + directory + "/folder", "delete")
</td><td>
@Html.MytripImageLink(Url.Action("Index", "File", new { id = directory }), "/mtm/FileIcon/folder", x.Name, 0, 32, 0)
</td><td>
@Html.MytripActionLink(Url.Action("Index", "File", new { id = directory }), x.Name)
</td><td></td>
<td></td></tr>
}
@foreach (System.IO.FileInfo x in Model.Files)
{
    string directory = (Model.Directory == "()") ? "()" + x.Name : Model.Directory + "()" + x.Name;
<tr><td>
@Html.MytripImgInput("/images/rename.png", "/File/Rename/" + directory + "/file", "rename")
@Html.MytripImgInput("/images/delete.png", "/File/Delete/" + directory + "/file", "delete")
</td><td>
@Html.FileImageLink(x.Name, 0, 32, 0, directory, x.Name, x.Extension)
</td><td>
@Html.FileActionLink(directory, x.Name, x.Extension)
</td><td>
@x.LastWriteTime
</td><td>
@x.Length 
@CoreLanguage.bytes
</td></tr>
}
</table></div>
@Html.Partial("Partial/_deleteModal") 
}